home *** CD-ROM | disk | FTP | other *** search
- /*** ArtDept Batch Converter (ABC) ***/
- /*** By Ro Sato ***/
- /*** Ryder Unit ***/
- /*** 7/2/92 ***/
- /*** Ver 1.0 ***/
-
- address "ADPro"
-
- options results
-
- /* Path and filename of the Arexx WaitForPort program... */
- waitforport = 'SYS:Rexxc/WaitForPort'
-
- /*
- open libraries
- */
-
- IF ~SHOW('Libraries','rexxsupport.library') THEN
- IF ~ADDLIB('rexxsupport.library',0,-30,0) THEN
- CALL Exit('Cannot open rexxsupport.library')
-
- IF ~SHOW('Libraries','rexxarplib.library') THEN
- IF ~ADDLIB('rexxarplib.library',0,-30,0) THEN
- CALL Exit('Render.REXX requires RexxArpLib.Library')
-
- /*
- INITIALIZATION
- */
- signal on syntax
-
- quitflag = 0
- SCALESW = 0
- DITHSW = 0
- LCSW = 0
- LPSW = 0
- HAMSW = 0
- DCTVSW = 0
- ANIMSW = 0
- FCSW = 0
- DCCB = 0
- DNUM = 0
- FULL = 0
- BYPS = 0
- PIXASP = 0
- XDCTV = 0
- YDCTV = 0
- FF = "Imagine"
- ex = 0
- OP = 0
- SC = 0
- C = 0
-
- /*
- Initialize the Rexxarp
- */
-
- row=SCREENROWS('WORKBENCH')
- col=SCREENCOLS('WORKBENCH')
- lace=SCREENLACE('WORKBENCH')
- IF (row<400|col<640|lace=0) THEN DO
- Result=OPENSCREEN(,,"HIRES" "LACE",,
- "ADPRO BATCH CONVERSION FRONTEND 1992 Ryder Unit","ABC",,640,,)
- END
-
- CALL OPENPORT(ABCPort)
-
- ADDRESS AREXX "'CALL CreateHost(ABCHost,ABCPort,ABC)'"
- ADDRESS COMMAND waitforport 'ABCHOST'
-
- idcmp = 'CLOSEWINDOW+GADGETUP+MENUPICK'
- flags = 'NOCAREREFRESH WINDOWCLOSE WINDOWDRAG',
- 'WINDOWDEPTH ACTIVATE'
-
-
- CALL OpenWindow(ABCHost,0,11,640,389,idcmp,flags,)
- CALL IFFImage(ABCHost, 'DH0:ABCWindow.IFF', 4, 11,640,389,N)
-
- CALL AddGadget(ABCHost,98,140, "Imagine","Imagin", "Imagine")
- CALL AddGadget(ABCHost,98,170, "LW", "LightW", "LW")
- CALL AddGadget(ABCHost,98,200, "Vista", "VistaP", "Vista")
- CALL AddGadget(ABCHost,98,230, "Real3D", "Real3D", "Real3D")
- CALL SetGadget(ABCHOST,"Imagine",'ON')
-
- CALL AddGadget(ABCHost,295,130, "SCALE", "SCALE ", "SCALE")
- CALL AddGadget(ABCHost,295,150, "DITHER", "DITHER", "DITHER")
- CALL AddGadget(ABCHost,295,170, "PIXASP", "PIXASP", "PIXASP")
- CALL AddGadget(ABCHost,295,190, "LOCKP", "LOCKP ", "LOCKP")
- CALL AddGadget(ABCHost,295,210, "256", "256 ", "256")
- CALL AddGadget(ABCHost,295,230, "ANIM", "ANIM ", "ANIM")
- CALL AddGadget(ABCHost,295,250, "FC24", "FC24 ", "FC24")
-
- CALL AddGadget(ABCHost,490,130, "IFF24", "IFF24 ", "IFF24")
- CALL AddGadget(ABCHost,490,155, "DCTV", "DCTV ", "DCTV")
- CALL AddGadget(ABCHost,490,180, "JPEG", "JPEG ", "JPEG")
- CALL AddGadget(ABCHost,490,205, "TIFF", "TIFF ", "TIFF")
- CALL AddGadget(ABCHost,490,230, "HAM", "HAM ", "HAM")
- CALL AddGadget(ABCHost,490,255, "TGA", "TGA ", "TGA")
-
- ADDRESS 'ABCHOST' WindowToFront
-
-
- /*
- LOOP
- */
-
- LOOP:
-
- do forever
- if quitflag = 1 then do
- call CloseWindow(ABCHOST)
- CLOSESCREEN(ABC)
- leave
- end
- t = WAITPKT(ABCPORT)
- do forever
- p=getpkt(ABCPORT)
- if c2d(p) = 0 then leave
- arg = getarg(p)
- t = reply(p,0)
-
- /*
- FLAG
- */
-
- if arg = CLOSEWINDOW then do
- quitflag = 1
- ex = 1
- end
- else if arg = "IFF24" then do
- FITYPE = "IFF"
- quitflag = 1
- FULL = 1
- end
- else if arg = "DCTV" then do
- FITYPE = "IFF"
- quitflag = 1
- DCTVSW = 1
- FULL = 1
- end
- else if arg = "JPEG" then do
- FITYPE = arg
- quitflag = 1
- FULL = 1
- end
- else if arg = "TIFF" then do
- FITYPE = arg
- quitflag = 1
- end
- else if arg = "HAM" then do
- FITYPE = "IFF"
- quitflag = 1
- HAMSW = 1
- OP = 1
- end
- else if arg = "TGA" then do
- FITYPE = "TARGA"
- quitflag =1
- FULL = 1
- end
- else if arg = "SCALE" then do
- IF SCALESW = 1 Then do
- SCALESW = 0
- CALL SetGadget(ABCHOST,arg,'OFF')
- end
- else do
- SCALESW = 1
- CALL SetGadget(ABCHOST,arg,'ON')
- end
- end
- else if arg = "DITHER" then do
- IF DITHSW = 1 Then do
- DITHSW = 0
- CALL SetGadget(ABCHOST,arg,'OFF')
- end
- else do
- DITHSW = 1
- CALL SetGadget(ABCHOST,arg,'ON')
- OP = 1
- end
- end
- else if arg = "PIXASP" then do
- IF PIXASP = 1 Then do
- PIXASP = 0
- CALL SetGadget(ABCHOST,arg,'OFF')
- end
- else do
- PIXASP = 1
- CALL SetGadget(ABCHOST,arg,'ON')
- OP = 1
- end
- end
- else if arg = "256" then do
- IF LCSW = 1 Then do
- LCSW = 0
- CALL SetGadget(ABCHOST,arg,'OFF')
- end
- else do
- LCSW = 1
- CALL SetGadget(ABCHOST,arg,'ON')
- OP = 1
- end
- end
- else if arg = "LOCKP" then do
- IF LPSW = 1 Then do
- LPSW = 0
- CALL SetGadget(ABCHOST,arg,'OFF')
- end
- else do
- LPSW = 1
- CALL SetGadget(ABCHOST,arg,'ON')
- OP = 1
- end
- end
- else if arg = "FC24" then do
- IF FCSW = 1 Then do
- FCSW = 0
- CALL SetGadget(ABCHOST,arg,'OFF')
- end
- else do
- FCSW = 1
- CALL SetGadget(ABCHOST,arg,'ON')
- end
- end
- else if arg = "ANIM" then do
- IF ANIMSW = 1 Then do
- ANIMSW = 0
- CALL SetGadget(ABCHOST,arg,'OFF')
- end
- else do
- ANIMSW = 1
- CALL SetGadget(ABCHOST,arg,'ON')
- end
- end
- else if arg = "Imagine" then do
- CALL SetGadget(ABCHOST,"Imagine",'ON')
- CALL SetGadget(ABCHOST,"LW",'OFF')
- CALL SetGadget(ABCHOST,"Vista",'OFF')
- CALL SetGadget(ABCHOST,"Real3d",'OFF')
- FF = arg
- end
- else if arg = "LW" then do
- CALL SetGadget(ABCHOST,"Imagine",'OFF')
- CALL SetGadget(ABCHOST,"LW",'ON')
- CALL SetGadget(ABCHOST,"Vista",'OFF')
- CALL SetGadget(ABCHOST,"Real3d",'OFF')
- FF = arg
- end
- else if arg = "Vista" then do
- CALL SetGadget(ABCHOST,"Imagine",'OFF')
- CALL SetGadget(ABCHOST,"LW",'OFF')
- CALL SetGadget(ABCHOST,"Vista",'ON')
- CALL SetGadget(ABCHOST,"Real3d",'OFF')
- FF = arg
- end
- else if arg = "Real3D" then do
- CALL SetGadget(ABCHOST,"Imagine",'OFF')
- CALL SetGadget(ABCHOST,"LW",'OFF')
- CALL SetGadget(ABCHOST,"Vista",'OFF')
- CALL SetGadget(ABCHOST,"Real3d",'ON')
- FF = arg
- end
- else nop
- end
- end
-
- ADPRO_TO_FRONT
-
- IF ex ~= 0 THEN CALL FINISH
-
-
- getdir '"Load IMAGE From?"' '"RAM:"'
- FINAME=(adpro_result)
- FINAME=gimmepath(FINAME)
- IF RC ~= 0 THEN EXIT
-
- getdir '"Save IMAGE Where?"' '"RAM:"'
- FONAME=(adpro_result)
- FONAME=gimmepath(FONAME);
- IF RC ~= 0 THEN EXIT
-
- IF FF ~= "Imagine" THEN DO
- GETSTRING '"Enter Base File Name"'
- FILENM = (adpro_result)
- IF RC ~= 0 THEN EXIT
- END;
-
- IF FITYPE = "TIFF" THEN DO
- ANIMSW = 0
- END;
-
- IF ANIMSW = 1 & DCTVSW = 1 THEN DO
- OP = 0
- DITHSW = 0
- LPSW = 0
- LCSW = 0
- ANIMSW = 1
- FULL = 0
- END;
-
- IF FULL = 1 THEN DO
- OP = 0
- DITHSW = 0
- LPSW = 0
- LCSW =0
- ANIMSW = 0
- END;
-
- getnumber '"Enter First Frame #"' 1 0 9999
- FRAME=adpro_result
- IF RC ~= 0 THEN EXIT
- getnumber '"Enter Last Frame # "' 30 1 9999
- TOTF=adpro_result
- FRC=TOTF-FRAME
- IF RC ~= 0 THEN EXIT
-
- IF HAMSW = 1 THEN DO
- OKAY2 "Render it NONLACE?"
- IF RC = 1 THEN DO
- YCOOR = 200
- END;
- ELSE DO
- YCOOR = 400
- END;
- OKAY2 "No OVERSCAN?"
- IF RC = 1 THEN DO
- XCOOR = 320
- END;
- ELSE DO
- XCOOR = 352
- IF YCOOR = 200 THEN DO
- YCOOR = 240
- END;
- ELSE DO
- YCOOR = 480
- END;
- END;
-
- IF XCOOR = 320 & YCOOR = 400 THEN ST = 2
- IF XCOOR > 320 & YCOOR < 400 THEN ST = 24
- IF XCOOR > 320 & YCOOR > 400 THEN ST = 26
- SCALESW = 0
- LCSW = 0
- ANIMSW = 0
- END;
-
- IF ANIMSW = 1 & FRC<10 THEN DO
- OKAY1 "Animation Less than 10 Frames X-)."
- EXIT
- END;
-
- IF DCTVSW = 1 THEN DO
- getnumber '"Final Image Size X"' 640 640 736
- XDCTV=(adpro_result)
- IF RC ~= 0 THEN CALL FINISH
- getnumber '"Final Image Size Y"' 200 200 482
- YDCTV=(adpro_result)
- IF RC ~= 0 THEN CALL FINISH
- getnumber '"Enter Color Bits"' 3 3 4
- DCCB =(adpro_result)
- IF RC ~= 0 THEN CALL FINISH
- OKAY2 "Bypass Art Department Pro?"
- IF RC = 1 THEN BYPS = 1
- IF SCALESW = 1 THEN DO
- IF BYPS = 0 THEN DO
- SCALESW = 1
- END;
- ELSE DO
- SCALESW = 0
- END;
- END;
- END;
-
- IF BYPS = 1 THEN PIXASP = 0
-
- IF SCALESW = 1 THEN DO
- getnumber '"Enter X Size"' 320 1 9999
- XCOOR=(adpro_result)
- IF RC ~= 0 THEN CALL FINISH
- getnumber '"Enter Y Size"' 200 1 9999
- YCOOR=(adpro_result)
- IF RC ~= 0 THEN CALL FINISH
- IF DCTVSW = 1 THEN DO
- IF XCOOR > XDCTV | YCOOR > YDCTV THEN DO
- OKAY1 "Scale Size Exceeds Image Size X-)."
- CALL FINISH
- END;
- END;
- END;
-
- IF PIXASP = 1 THEN DO
- getnumber '"Enter X Aspect"' 22 1 9999
- XASP=(adpro_result)
- IF RC~ = 0 THEN CALL FINISH
- getnumber '"Enter Y Aspect"' 26 1 9999
- YASP=(adpro_result)
- IF RC~ = 0 THEN CALL FINISH
- END;
-
- IF DITHSW = 1 THEN DO
- getnumber '"Enter Dither #"' 1 1 6
- DNUM=(adpro_result)
- IF RC ~= 0 THEN CALL FINISH
- END;
- ELSE DNUM = 0
-
- IF ANIMSW = 1 THEN DO
- getstring '"Enter Path & Name for anim."' 'RAM:TEST.anim'
- animname=(adpro_result)
- IF RC ~= 0 THEN CALL FINISH
- END;
-
- do forever
- Postmsg(200, 180, "Processing Frame "||FRAME)
-
- lformat "UNIVERSAL"
-
- IF FF = "Imagine" THEN DO
- FEXT=FRAME/10000
- IF LENGTH(FEXT) = 5 THEN FEXT = FEXT||"0"
- IF LENGTH(FEXT) = 4 THEN FEXT = FEXT||"00"
- IF LENGTH(FEXT) = 3 THEN FEXT = FEXT||"000"
- FEXT=RIGHT(FEXT,4)
- LOADF=FINAME||"PIC."||FEXT
- SAVEF=FONAME||"PIC."||FEXT
- END;
-
- IF FF = "LW" THEN DO
- IF FRAME = 0 THEN DO
- LOADF=FINAME||FILENM||"000"
- SAVEF=FONAME||FILENM||"000"
- END;
- ELSE DO
- FEXT=FRAME/1000
- IF LENGTH(FEXT) = 4 THEN FEXT = FEXT||"0"
- IF LENGTH(FEXT) = 3 THEN FEXT = FEXT||"00"
- FEXT=RIGHT(FEXT,3)
- LOADF=FINAME||FILENM||FEXT
- SAVEF=FONAME||FILENM||FEXT
- END;
- END;
-
- IF FF = "Vista" THEN DO
- IF FRAME = 0 THEN DO
- LOADF=FINAME||FILENM||"00000"
- SAVEF=FONAME||FILENM||"00000"
- END;
- ELSE DO
- FEXT=FRAME/100000
- IF LENGTH(FEXT) = 6 THEN FEXT = FEXT||"0"
- IF LENGTH(FEXT) = 5 THEN FEXT = FEXT||"00"
- IF LENGTH(FEXT) = 4 THEN FEXT = FEXT||"000"
- IF LENGTH(FEXT) = 3 THEN FEXT = FEXT||"0000"
- FEXT=RIGHT(FEXT,5)
- LOADF=FINAME||FILENM||FEXT
- SAVEF=FONAME||FILENM||FEXT
- END;
- END;
-
- IF FF = "Real3D" THEN DO
- IF FRAME = 0 THEN DO
- LOADF=FINAME||FILENM||"0"
- SAVEF=FONAME||FILENM||"0"
- END;
- ELSE DO
- LOADF=FINAME||FILENM||FRAME
- SAVEF=FONAME||FILENM||FRAME
- END;
- END;
-
- IF BYPS = 0 THEN DO
- load LOADF
- IF RC ~= 0 THEN DO
- OKAY1 "File Cannot be Located."
- CALL FINISH
- END;
- END;
-
- IF PIXASP = 1 THEN DO
- OPERATOR DEFINE_PXL_ASPECT
- IF RC ~= 0 THEN EXIT
- OXASP = WORD(ADPRO_RESULT, 1)
- OYASP = WORD(ADPRO_RESULT, 2)
- IF XASP = OXASP & YASP = OYASP THEN PIXASP = 0
- IF SCALEW = 1 THEN DO
- OXASP = XCOOR
- OYASP = YCOOR
- END;
- END;
-
- C = C + 1
-
- IF FCSW = 1 & C = 1 THEN DO
- SFORMAT "FC24"
- SAVE "XXX" "RAW" "BOARD_NO" 0 "B_WIDTH" 1024 "CLEAR"
- END;
-
- sformat FITYPE
-
-
- /*
- OPERATORS
- */
-
- IF HAMSW = 1 THEN DO
- RENDER_TYPE HAM
- SCALESW = 1
- SCREEN_TYPE ST
- END;
-
- IF SCALESW = 1 THEN DO
- 'ABS_SCALE' XCOOR YCOOR
- IF RC ~= 0 THEN CALL FINISH
- END;
-
- IF PIXASP = 1 THEN DO
- XA = (OXASP/OYASP) * 100
- YA = 100
- IF XASP > YASP THEN DO
- XA = XASP * 10000 / (YASP*XA)
- END;
- ELSE DO
- XA = XA * (YASP/XASP)
- END;
- IF XA < 100 THEN DO
- YA = 10000/XA
- XA = 100
- END;
-
- PCT_SCALE TRUNC(XA+0.5) TRUNC(YA+0.5)
- IF RC~= 0 THEN DO
- PCT_SCALE TRUNC((10000/YA)+0.5) TRUNC((10000/XA)+0.5)
- IF RC = 0 THEN DO
- OPERATOR DEFINE_PXL_ASPECT XASP YASP
- END;
- END;
- ELSE DO
- OPERATOR DEFINE_PXL_ASPECT XASP YASP
- END;
- END;
-
- DITHER DNUM
-
- IF LCSW = 1 THEN DO
- RENDER_TYPE 256
- END;
-
- IF LPSW = 1 THEN DO
- PSTATUS LOCKED
- END;
- ELSE DO
- PSTATUS UNLOCKED
- END;
-
- IF OP = 1 THEN DO
- EXECUTE
- IF RC ~= 0 THEN CALL FINISH
- END;
-
- IF ANIMSW = 1 THEN DO
- open('out',FONAME||'pic.list','w')
- END;
-
- IF BYPS = 1 THEN DO
- address command "IFFtoDCTV"||" "||LOADF||" "||"-w"||XDCTV||" -h"||YDCTV||" -d"||DCCB||" -o"||FONAME
- IF RC ~= 0 THEN DO
- OKAY1 "File Cannot be Located."
- CALL FINISH
- END;
- DCTVSW = 0
- END;
- ELSE DO
- IF OP = 1 THEN DO
- SAVE SAVEF "Image"
- END;
- ELSE DO
- SAVE SAVEF "RAW"
- END;
- END;
-
- IF DCTVSW = 1 THEN DO
- address command "IFFtoDCTV"||" "||SAVEF||" "||"-w"||XDCTV||" -h"||YDCTV||" -d"||DCCB||" -o"||FONAME
- address command "delete"||" "||SAVEF
- END;
-
- IF FCSW = 1 THEN DO
- SFORMAT
- CURRENTSAVER = ADPRO_RESULT
-
- SFORMAT "FC24"
-
- XSIZE
- THESIZE = ADPRO_RESULT
- YSIZE
- THEYSIZE = ADPRO_RESULT
-
- IF THESIZE < 384 THEN THESIZE = 768
- IF THESIZE = 384 AND THEYSIZE < 482 THEN THESIZE = 768
-
- SAVE "XXX" "RAW" "BOARD_NO" 0 "B_WIDTH" THESIZE "CENTER" "BOARD" "ON" "IMAGE"
-
- SFORMAT CURRENTSAVER
- END;
-
- IF ANIMSW = 1 THEN DO
- writeln('out',SAVEF||'.dctv')
- END;
-
- FRAME=FRAME+1
- IF FRAME>TOTF then leave
- END;
-
- IF ANIMSW = 1 THEN DO
- close('out')
- picout=FONAME||"pic.list"
- address command "makeanim "picout" "animname""
- IF RC ~= 0 THEN DO
- OKAY1 "Failed to make animation."
- CALL FINISH
- END;
- address command "delete "picout
- END;
-
- OKAY1 "Finished!"
-
- FINISH:
-
- Postmsg()
- EXIT
-
- gimmepath:
- arg fullnamegx;
- tempgx = reverse(fullnamegx);
- lengx = length(fullnamegx); /* get length of string */
- slashdex = index(tempgx,'/'); /* first occurance of '/' from right */
- colondex = index(tempgx,':'); /* first occurance of ':' from right */
- seploc = 0; /* assumes current dir, no path supplied */
- if slashdex ~= 0 then do /* we assume we are in a DIR */
- seploc = (lengx)+1;
- fullnamegx=fullnamegx||"/"
- end;
- else do
- if colondex <= 1 then do
- seploc = (lengx-colondex)+1;
- end;
- else do
- seploc =(lengx)+1;
- fullnamegx=fullnamegx||"/"
- end;
- end;
- gxname = substr(fullnamegx,seploc+1); /* if you ever need it */
- gxpath = left(fullnamegx,seploc);
- return(gxpath);
-
-